import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ExamQuestionsVO, ExamQuestionsForm, ExamQuestionsQuery } from '@/api/answer/examQuestions/types';

/**
 * 查询考试题目关联列表
 * @param query
 * @returns {*}
 */

export const listExamQuestions = (query?: ExamQuestionsQuery): AxiosPromise<ExamQuestionsVO[]> => {
  return request({
    url: '/answer/examQuestions/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询考试题目关联详细
 * @param id
 */
export const getExamQuestions = (id: string | number): AxiosPromise<ExamQuestionsVO> => {
  return request({
    url: '/answer/examQuestions/' + id,
    method: 'get'
  });
};

/**
 * 新增考试题目关联
 * @param data
 */
export const addExamQuestions = (data: ExamQuestionsForm) => {
  return request({
    url: '/answer/examQuestions',
    method: 'post',
    data: data
  });
};

/**
 * 修改考试题目关联
 * @param data
 */
export const updateExamQuestions = (data: ExamQuestionsForm) => {
  return request({
    url: '/answer/examQuestions',
    method: 'put',
    data: data
  });
};

/**
 * 删除考试题目关联
 * @param id
 */
export const delExamQuestions = (id: string | number | Array<string | number>) => {
  return request({
    url: '/answer/examQuestions/' + id,
    method: 'delete'
  });
};
